/*
 * @Author: chenjie 2466328944@qq.com
 * @Date: 2025-02-06 15:11:49
 * @LastEditors: chenjie 2466328944@qq.com
 * @LastEditTime: 2025-02-06 17:02:34
 * @FilePath: \translate\ruoyi-admin\src\main\java\com\ruoyi\app\controller\AppHtPhotoRecordController.java
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package com.ruoyi.app.controller;

import com.ruoyi.app.domain.HtPhotoRecord;
import com.ruoyi.app.service.IHtPhotoRecordService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 拍照记录表Controller
 *
 * @author ruoyi
 * @date 2025-01-15
 */
@RestController
@RequestMapping("/system/photoRecord")
public class AppHtPhotoRecordController extends BaseController {
    @Autowired
    private IHtPhotoRecordService htPhotoRecordService;

/**
 * 查询拍照记录表列表
 */
@PreAuthorize("@ss.hasPermi('system:photoRecord:list')")
@GetMapping("/list")
    public TableDataInfo list(HtPhotoRecord htPhotoRecord) {
        startPage();
        List<HtPhotoRecord> list = htPhotoRecordService.selectHtPhotoRecordList(htPhotoRecord);
        return getDataTable(list);
    }

    /**
     * 导出拍照记录表列表
     */
    @PreAuthorize("@ss.hasPermi('system:photoRecord:export')")
    @Log(title = "拍照记录表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HtPhotoRecord htPhotoRecord) {
        List<HtPhotoRecord> list = htPhotoRecordService.selectHtPhotoRecordList(htPhotoRecord);
        ExcelUtil<HtPhotoRecord> util = new ExcelUtil<HtPhotoRecord>(HtPhotoRecord. class);
        util.exportExcel(response, list, "拍照记录表数据");
    }

    /**
     * 获取拍照记录表详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:photoRecord:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id) {
        return success(htPhotoRecordService.selectHtPhotoRecordById(id));
    }

    /**
     * 新增拍照记录表
     */
    @PreAuthorize("@ss.hasPermi('system:photoRecord:add')")
    @Log(title = "拍照记录表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HtPhotoRecord htPhotoRecord) {
        return toAjax(htPhotoRecordService.insertHtPhotoRecord(htPhotoRecord));
    }

    /**
     * 修改拍照记录表
     */
    @PreAuthorize("@ss.hasPermi('system:photoRecord:edit')")
    @Log(title = "拍照记录表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HtPhotoRecord htPhotoRecord) {
        return toAjax(htPhotoRecordService.updateHtPhotoRecord(htPhotoRecord));
    }

    /**
     * 删除拍照记录表
     */
    @PreAuthorize("@ss.hasPermi('system:photoRecord:remove')")
    @Log(title = "拍照记录表", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids) {
        return toAjax(htPhotoRecordService.deleteHtPhotoRecordByIds(ids));
    }
}
